<template>
  <nav class="tab-bar">
    <router-link class="tab-item" v-for="item in list" :key="item.text" :to="item.path">
      <i class="iconfont" :class="item.img" />
      <span>{{ item.text }}</span>
    </router-link>
  </nav>
</template>

<script>
import "../assets/iconfont/iconfont.css";
export default {
  data() {
    return {
      list: [
        {
          text: "分类",
          img: 'icon-fenlei',
          path: "/category",
        },
        {
          text: "购物车",
          img: 'icon-gouwuche',
          path: "/cart",
        },
        {
          text: "我的",
          img: 'icon-geren',
          path: "/center",
        },
      ],
    };
  },
  computed: {
    //获取当前的路由地址
    currentPath() {
      return this.$route.path;
    }
  },
  methods: {
    btnAction() {
      // console.log(this.$router);//获取当前的整个路由对象

      // console.log(this.$route); //当前路由的信息
    }
  }
};
</script>

<style></style>
